<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript">
		/* function createPerson(a,b,c){
		 var obj=new Object();
		 obj.name=a;
		 obj.age=b;
		 obj.sex=c;
		 console.log(obj);
		 }
		 createPerson('孙悟空',18,'男') */
		/* function createPerson(a, b, c) {
			var obj = {
				name :  a,
				age : b,
				sex : c

			}
			alert(obj);
		}
		createPerson('孙悟空', 18, '男') */
		var abc = {
			name : '孙悟空',
			fun : Person
		}
		var dfg = {
			name : '123',
			fun : Person
		}
		function Person(zxc) {
			console.log('person');
			console.log(this.fun);
		}
		abc.fun();
/* 		function Dog(name,age,color){
			this.name=name;
			this.age=age;
			this.color=color;	
		}
		var dog1= new Dog('白白',15,'白色');
		var dog2= new Dog('白白',16,'白色');
		var dog3= new Dog('白白',17,'白色');
		console.log(dog1);
		console.log(dog2);
		console.log(dog3);
		
		function area(r){
			return Math.PI*Math.pow(r,2);//圆的面积
			
		}
		console.log(area(10)); */
	
		 function odd(a){
		  /* 	if(a%2==0){
		  		alert('true');
		  	}else{
		  		alert('false');
		  	} */
			return a%2==1;
		}
		console.log(odd(10));
		function Bird(name,color,height){
			this.name=name;
			this.color=color;
			this.height=height;
			this.sayhello= function(){
				alert(this.name);
				return this;
			}
		}
		var bird=new Bird('大鹏','绿色','10000');//var per =new Object();
		console.log(bird.sayhello());
		
		//console.log(dog instanceof Dog); //检测dog对象是由哪一个类构造出来的。
		、
		function Dog(name,age,color){
			this.name=name;
			this.age=age;
			this.color=color;
			this.sayhello=sayhello;
		}
		function sayhello(){
			alert('Hello')
		}
		var dog1=new Dog('旺财',3,'褐色');//var per =new Object();
		console.log(dog1.sayhello());
		var dog2=new Dog('旺王',1 ,'黄色');//var per =new Object();
		console.log(dog2.sayhello());
		alert(dog1.sayhello==dog2.sayhello);
		
		function Dog(name,age,color){
			this.name=name;
			this.age=age;
			this.color=color;
			
		}
		var dog1=new Dog('旺财',3,'褐色');//var per =new Object();
		var dog2=new Dog('旺王',1 ,'黄色');//var per =new Object();
		Dog.prototype.sayHello=function(){
			alert('我是原型对象中的sayHello');
		}
		console.log(dog1.sayHello());
		console.log(dog2.sayHello());
		console.log(dog.__proto__.__proto__.hasOwnPropert('sayHello'));
		//精确检测sayHello属于哪一级原型  __proto__访问原型
	</script>
</body>
</html>